package validation;

import dbmanager.DBManager;

public class Startwith implements Validation 
{
	DBManager db;
	String actualvalue;
	String validationvalue;
	String Refvalue;
	
	public String getMessage() 
	{
		return "must start with " + validationvalue;
	}
	public void setDbmanager(DBManager db) 
	{
		this.db =db;
	}
	public boolean validate(String Value) 
	{
		return false;
	}
	public boolean validate(String actualvalue, String validationvalue)
	{
		int length = validationvalue.length();
		if(length > actualvalue.length())
			return false;
		else
		{
			String substring = validationvalue.substring(0,length);
			String temp=actualvalue.substring(0,length).toLowerCase();
			if(substring.toLowerCase().equals(temp))
				return true;
		}
		return false;
	}
	public boolean validate(String Value, String ConditionValue, String Refvalue) 
	{	
		this.actualvalue = Value;
		this.validationvalue =ConditionValue;
		return  validate(Value,ConditionValue);
	}
	public void setBasicvalue(String value) {
		// TODO Auto-generated method stub
		
	}
	public static void main(String[] args) {
		Startwith sw = new Startwith();
		System.out.println(sw.validate("asbcdefg", "ab",""));
		System.out.println(sw.getMessage());		
	}

}
